Memory management system and method for a mobile device

ABSTRACT

In accordance with the teachings described herein, systems and methods are provided for managing memory on a mobile device. A maximum amount of available data storage memory may be allocated for storing data for each of a plurality of software applications loaded on the mobile device. If additional memory is needed for an executing software application, then one of the plurality of software applications may be selected for memory clean-up. Data may then be deleted from the data storage memory allocated to the selected software application in accordance with a pre-established memory retention policy for the selected software application.

FIELD

The technology described in this patent document relates generally tothe fields of memory allocation and management. More particularly, thepatent document describes a memory management system and method that isparticularly well-suited for use in a mobile device.

BACKGROUND AND SUMMARY

In a typical mobile device, there are an increasing number of competingsoftware applications, each with different memory requirements, cachingpolicies and memory management requirements. Such mobile devices mayinclude cellular telephones, two-way paging devices, personal digitalassistants, and/or other devices having similar memory constraints.

In accordance with the teachings described herein, systems and methodsare provided for managing memory on a mobile device. A maximum amount ofavailable data storage memory may be allocated for storing data for eachof a plurality of software applications loaded on the mobile device. Ifadditional memory is needed for an executing software application, thenone of the plurality of software applications may be selected for memoryclean-up. Data may then be deleted from the data storage memoryallocated to the selected software application in accordance with apre-established memory retention policy for the selected softwareapplication.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an example memory management system for amobile device;

FIG. 2 illustrates an example memory allocation and retention table foruse with the memory management system of FIG. 1;

FIG. 3 is a flow diagram illustrating an example memory managementmethod for a mobile device; and

FIG. 4 is a block diagram of an example mobile device.

DETAILED DESCRIPTION

With reference now to the drawing figures, FIG. 1 is a block diagram ofan example memory management system for a mobile device 10. The systemincludes a memory management module 12, a plurality of softwareapplications 14, and a data storage location 16. Also illustrated are avirtual machine 18 and a user interface 20.

The memory management module 12 may be a software application stored ina memory location and executed by the virtual machine 18 to performmemory allocation and retention functions, as described below. Thememory management module 12 may, for example, be a JAVA® applicationthat operates on a JAVA® virtual machine 18 installed on the mobiledevice 10. The software applications 14 may also be JAVA® applicationsthat are stored in a memory location and executed by the virtual machine18. It should be understood, however, that the memory management module12 and software applications 14 may be executed using operating systemsother than a JAVA® virtual machine 18. The software applications 14 mayinclude an electronic messaging application, a calendar application, anaddress book application, an Internet browser application, a gameapplication(s), and/or other software. The data storage location 16 maybe a writable storage medium, such as a FLASH memory (see, e.g., FIG.4), for storing application data. The software code for the memorymanagement module 12 and software applications 14 may also be stored inthe data storage location 16.

In operation, the memory management module 12 allocates the amount ofmemory 16 available to each of the software applications 14 for storingdata, and implements memory retention policies to free needed memory.The memory management module 12 maintains memory allocation andretention data for the software applications 14 to control the amount ofmemory 16 that each software application 14 may utilize (see, e.g., FIG.2). The amount of memory 16 allocated to each software application 14may be configured by the memory management module 12 when the softwareapplications 14 are installed to the mobile device 10, and maypreferably be modified by a device user via the user interface 20. Ifadditional memory is needed by a particular software application 14,then the memory management module 12 may allocate additional memory(i.e., free memory), if available, or may attempt to free additionalmemory by implementing the memory retention policies.

For example, if Application 1 requires additional memory to store data,then the memory management module 12 may first determine if any freememory is available for allocation to Application 1. Free memory mayeither be allocated automatically by the memory management module 12 ormay be allocated with permission from the device user. If no free memoryis available, then the memory management module 12 may attempt to “cleanup” the memory segment allocated to Application 1 or may reallocatememory from one or more of the memory segments allocated to Applications2-N in accordance with the memory retention policies.

FIG. 2 illustrates an example memory allocation and retention table 30for use with the memory management system of FIG. 1. The table 30includes memory allocation data 32–34 and memory retention data 36–38for each software application 40–43. The memory allocation data 32–34identifies a minimum memory allocation 32, a maximum memory allocation33 and a memory threshold 34 for each of the software applications40–43. The memory retention data 36–38 identifies a memory retentionpolicy 36, a memory retention target 37 and a priority level 38 for eachof the software applications 40–43.

With reference to the memory allocation data 32–34, the minimum memoryallocation 32 identifies the minimum amount of memory that needs to beallocated to a particular software application 40–43 for properoperation. The maximum memory allocation 33 identifies the amount ofmemory currently allocated for a particular application 40–43. Thememory threshold 34 represents the amount of available memory for eachsoftware application 40–43 that may be filled before executing thememory retention policies. Example memory allocation values 32–34 areillustrated in FIG. 2 for a browser application, a game application 41,an email application 42, and an address book application 43. Forinstance, the example browser application 40 has a minimum memoryallocation of 0.025 T, a maximum memory allocation of 0.25 T and amemory threshold of 0.1875 T, where T is the total available memory.Illustrated in parentheses are example memory allocation values 32–34for a mobile device having a 4 megabyte memory device.

With reference to the memory retention data 36–38, the memory retentionpolicy 36 identifies the memory retention algorithm used for deletingstored data for a particular software application 40–43 to freeadditional memory. Example memory retention policies 36 areleast-recently-used (LRU), largest file size, first-in-first-out (FIFO),and never delete. The memory retention target 37 identifies an amount offilled memory that the memory management module 12 will attempt toachieve for a particular software application 40–43 by implementing thememory retention policy 36. For instance, in the illustrated example, ifthe memory management module 12 applies a LRU memory retention policy 36to Application 1, then the stored data that has been accessed the least(i.e., the least-recently-used data) will be deleted until 0.125 T bytesof data remain in the memory segment 16 allocated to Application 1.

The memory retention priority 38 may be used by the memory managementmodule 12 to select which memory segments should be given the highestpriority for memory retention purposes. For example, if additionalmemory is needed for one of the software applications 40–43 (and no freememory is available), then the memory management module 12 may firstapply the designated memory retention policy 36 to the softwareapplication memory segment having the lowest priority 38. For instance,in the illustrated example, if any of the software applications 40–43require additional memory, then the memory management module 12 mayfirst attempt to free the needed memory by applying the designatedmemory retention policy 36 (largest file size) to Application 2 (thegame application), which has the lowest memory retention priority.

FIG. 3 is a flow diagram illustrating an example memory managementmethod for a mobile device. At step 52, a new software application isloaded onto the mobile device. Memory allocation and retention policiesare then defined for the new software application at step 54.Preferably, the memory allocation and retention policies are definedautomatically upon loading the software application. In other cases,however, the memory allocation and retention policies may be defined bya device user.

After the software application is loaded and its memory allocation andretention policies are defined, the method 50 proceeds to step 56. Themethod 50 remains at step 56 during normal device operation, unlessadditional memory is needed by the software application. If additionalmemory is needed, then the method 50 proceeds to decision step 58. Atstep 58, the method 50 determines if free memory is available forallocation to the software application. If free memory is available,then the method skips to step 64 to reallocate the needed free memory.Else, if no free memory is available, then the method attempts to freeadditional memory at steps 60 and 62.

At step 60, an application memory segment is selected according to anapplication priority hierarchy, as described above with reference toFIG. 2. Then, at step 62 a memory retention policy (e.g., LRU, largestfile size, FIFO, etc.) is applied to the selected application memorysegment to free additional memory. The memory retention policy may bedifferent for each software application. For example, the method mayexecute a sub-routine to identify memory retention parameters specificto a particular software application. An example system and method foridentifying and applying a memory retention policy specific to aparticular software application is described in the co-ownedInternational Patent Application No. PCT/CA03/01104, entitled “DataStore Management System And Method For Wireless Devices,” which isincorporated herein by reference. Once the memory retention policy hasbeen implemented, then the memory is re-allocated at step 64.

At step 66, the method determines if sufficient memory has beenreallocated to the software application. If so, then the method 50 endsat step 72. Else, if additional memory is needed, then the methodproceeds to step 68. At step 68, the method 50 determines if there areany additional software memory segments available to free additionalmemory. If so, then the method returns to step 60 to select one of theadditional software memory segments according to the applicationpriority hierarchy. If no additional memory segments are available,however, then the method returns an error message at step 70 and ends atstep 72.

FIG. 4 is a block diagram illustrating an example mobile communicationdevice 2100. The mobile communication device 2100 includes a processingsubsystem 2138, a communications subsystem 2111, a short-rangecommunications subsystem 2140, a memory subsystem 2124, 2126, andvarious other device subsystems and/or software modules 2142. The mobilecommunication device 2100 also includes a user interface, which mayinclude a display 2122, a serial port 2130, a keyboard 2132, a speaker2134, a microphone 2136, one or more auxiliary input/output devices2128, and/or other user interface devices.

The processing subsystem 2138 controls the overall operation of themobile communication device 2100. Operating system software executed bythe processing subsystem 2138 may be stored in a persistent store, suchas a flash memory 2124, but may also be stored in other types of memorydevices in the memory subsystem, such as a read only memory (ROM) orsimilar storage element. In addition, system software, specific deviceapplications, or parts thereof, may be temporarily loaded into avolatile store, such as a random access memory (RAM) 2126. Communicationsignals received by the mobile communication device 2100 may also bestored to RAM 2126.

The processing subsystem 2138, in addition to its operating systemfunctions, enables execution of software applications 2124 on the device2100. A predetermined set of applications that control basic deviceoperations, such as data and voice communications, may be installed onthe device 2100 during manufacture. A personal information manager (PIM)application, including an electronic messaging application, may beinstalled on the device. The PIM may, for example, be operable toorganize and manage data items, such as email, calendar events, voicemails, appointments, and task items. The PIM application may also beoperable to send and receive data items via the wireless network 2119.In addition, the memory management module 2124C and application datastorage location 16, as described above, may also me included in theflash memory 2124.

Communication functions, including data and voice communications, areperformed through the communication subsystem 2111, and possibly throughthe short-range communications subsystem 2140. The communicationsubsystem 2111 includes a receiver 2112, a transmitter 2114 and one ormore antennas 2116, 2118. In addition, the communication subsystem 2111also includes a processing module, such as a digital signal processor(DSP) 2120 or other processing device(s), and local oscillators (LOs)2113. The specific design and implementation of the communicationsubsystem 2111 is dependent upon the communication network in which themobile communication device 2100 is intended to operate. For example, amobile communication device 2100 may include a communication subsystem2111 designed to operate within the Mobitex™ mobile communicationsystem, the DataTAC™ mobile communication system, a GSM network, a GPRSnetwork, a UMTS network, and/or an EDGE network.

Network access requirements vary depending upon the type ofcommunication system. For example, in the Mobitex and DataTAC networks,mobile communication devices are registered on the network using aunique personal identification number or PIN associated with eachdevice. In UMTS and GSM/GPRS networks, however, network access isassociated with a subscriber or user of a device. A GPRS devicetherefore requires a subscriber identity module, commonly referred to asa SIM card, in order to operate on a GSM/GPRS network.

When required network registration or activation procedures have beencompleted, the mobile communication device 2100 may send and receivecommunication signals over the communication network 2119. Signalsreceived by the antenna 2116 from the communication network 2119 arerouted to the receiver 2112, which provides signal amplification,frequency down conversion, filtering, channel selection, etc., and mayalso provide analog to digital conversion. Analog-to-digital conversionof the received signal allows the DSP to perform more complexcommunication functions, such as demodulation and decoding. In a similarmanner, signals to be transmitted to the network 2119 are processed(e.g., modulated and encoded) by the DSP 2120 and are then provided tothe transmitter 2114 for digital to analog conversion, frequency upconversion, filtering, amplification and transmission to thecommunication network 2119 (or networks) via the antenna 2118.

In addition to processing communication signals, the DSP 2120 providesfor receiver 2112 and transmitter 2114 control. For example, gainsapplied to communication signals in the receiver 2112 and transmitter2114 may be adaptively controlled through automatic gain controlalgorithms implemented in the DSP 2120.

In a data communication mode, a received signal, such as a text messageor web page download, is processed by the communication subsystem 2111and input to the processing device 2138. The received signal is thenfurther processed by the processing device 2138 for output to a display2122, or alternatively to some other auxiliary I/O device 2128. A deviceuser may also compose data items, such as email messages, using akeyboard 2138 and/or some other auxiliary I/O device 2128, such as atouchpad, a rocker switch, a thumb-wheel, or some other type of inputdevice. The composed data items may then be transmitted over thecommunication network 2119 via the communication subsystem 2111.

In a voice communication mode, overall operation of the device issubstantially similar to the data communication mode, except thatreceived signals are output to a speaker 2134, and signals fortransmission are generated by a microphone 2136. Alternative voice oraudio I/O subsystems, such as a voice message recording subsystem, mayalso be implemented on the device 2100. In addition, the display 2122may also be utilized in voice communication mode, for example to displaythe identity of a calling party, the duration of a voice call, or othervoice call related information.

The short-range communications subsystem 2140 enables communicationbetween the mobile communication device 2100 and other proximate systemsor devices, which need not necessarily be similar devices. For example,the short-range communications subsystem 2140 may include an infrareddevice and associated circuits and components, or a Bluetooth™communication module to provide for communication with similarly-enabledsystems and devices.

This written description uses examples to disclose the invention,including the best mode, and also to enable a person skilled in the artto make and use the invention. The patentable scope of the invention mayinclude other examples that occur to those skilled in the art.

1. A mobile device, comprising: a memory subsystem; a processingsubsystem coupled to the memory subsystem and operable to store andretrieve data in the memory subsystem and to execute instructions storedin the memory subsystem; and a memory management module stored in thememory subsystem and executed by the processing subsystem and comprisinginstructions operable to cause the mobile device to allocate a maximumamount of available data storage memory in the memory subsystem forstoring data for each of a plurality of software applications loaded onthe mobile device; the memory management module being further operableto automatically detect that additional data storage memory is neededfor an executing software application, select one of the plurality ofsoftware applications for memory clean-up, and delete data from the datastorage memory allocated to the selected software application inaccordance with a pre-established memory retention policy for theselected software application; wherein the memory management module isfurther operable to decrease the maximum amount of available datastorage memory for the selected software application and proportionallyincrease the maximum amount of available memory for the executingapplication.
 2. The mobile device of claim 1, further comprising: amemory allocation and retention table stored in the memory subsystem andmaintained by the memory management module, the memory allocation andretention table identifying the maximum amount of available storagememory for each of the plurality of software applications.
 3. The mobiledevice of claim 2, wherein the memory allocation and retention tableidentifies the memory retention policy for the selected softwareapplication.
 4. The mobile device of claim 3, wherein the memoryallocation and retention table identifies a memory retention policy foreach of the plurality of software applications.
 5. The mobile device ofclaim 1, wherein the memory management module is further operable toallocate a minimum amount of available data storage memory in the memorysubsystem for storing data for each of the plurality of softwareapplication; wherein the memory management module prevents the maximumamount of available memory for each of the plurality of softwareapplications from being decreased below the allocated minimum amount ofavailable data storage memory.
 6. The mobile device of claim 1, whereinthe memory management module automatically detects that additional datastorage memory is needed for an executing software application bydetermining that an amount of stored data in the data storage memory forthe executing software application has reached a pre-established memorythreshold value for the executing software application.
 7. The mobiledevice of claim 1, wherein the memory management module selected one ofthe software applications for memory clean-up according apre-established priority level of the selected software application. 8.A method of managing memory in a mobile device, comprising: allocating amaximum amount of available data storage memory for each of a pluralityof software applications loaded on the mobile device; automaticallydetecting that additional memory is needed for an executing softwareapplication; selecting one of the software applications for memoryclean-up; deleting data from the data storage memory allocated to theselected software application in accordance with a pre-establishedmemory retention policy for the selected software application; and ifthe selected software application is different than the executingsoftware application, then decreasing the maximum amount of availablememory for the selected software application and proportionallyincreasing the maximum amount of available memory for the executingsoftware application.
 9. The method of claim 8, further comprising:allocating a minimum amount of data storage memory for each of theplurality of software applications loaded on the mobile device; andpreventing the maximum amount of available memory for the selectedsoftware application from being decreased below the allocated minimumamount of data storage memory for the selected software application. 10.The method of claim 8, further comprising: establishing a memorythreshold value for the executing software application; andautomatically detecting that additional memory is needed for theexecuting application by detecting that an amount of stored data in thedata storage memory for the executing software application has reachedthe memory threshold value.
 11. The method of claim 8, wherein thesoftware application selected for memory clean-up is selected accordingto a priority level.
 12. The method of claim 8, further comprising:determining a memory retention target for the selected softwareapplication; and deleting data from the data storage memory allocated tothe selected application until an amount of data remaining in the datastorage memory location is at or below the memory retention target. 13.The method of claim 8, further comprising: determining if sufficientmemory is available for the executing application; if sufficient memoryis not available for the executing application, then selecting anotherof the software applications for memory clean-up.
 14. A mobile device,comprising: a memory subsystem for storing data from a plurality ofsoftware applications; means for allocating a maximum amount of memoryin the memory subsystem available to store date from each of theplurality of software applications; means for automatically detectingthat additional memory is needed for an executing software application;means for selecting one of the plurality of software applications; meansfor deleting data from the memory allocated to the selected softwareapplication in accordance with a pre-established memory retentionpolicy; and means for decreasing the maximum amount of memory allocatedto the selected software application and proportionally increasing themaximum amount of available memory for the executing softwareapplication.